package com.c.ctgproject.ui.review.material

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.c.ctgproject.base.BaseViewModel
import com.c.ctgproject.http.ApiMethods
import com.c.ctgproject.utils.MyLog
import com.c.ctgproject.utils.awaitSync
import com.c.ctgproject.utils.launch
import com.c.ctgproject.utils.userToken

class CheckPhotoViewModel : BaseViewModel() {
    private val mResult = MutableLiveData<String>()
    val result: LiveData<String> get() = mResult

    fun getPhoto(materialNumber: String) {
        MyLog.d("materialNumber:$materialNumber")
        launch {
            mResult.value = ApiMethods.getApiService().getMaterialPhoto(userToken, materialNumber).awaitSync()
        }
    }
}